// 用来封装所有与组织结构相关的网络请求
import request from '@/utils/request'

// 封装接口
// 获取所有的组织结构数据
export function getDepartmentApi () {
  return request({
    url: '/company/department'
  })
}

// 根据id删除组织结构
export function delDepartmentApi (id) {
  return request({
    url: `/company/department/${id}`,
    method: 'DELETE'
  })
}

// 新增部门
export function addDepartmentApi (data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}
// 根据id获取部门信息
export function getDepartmentByIdApi (id) {
  return request({
    url: `/company/department/${id}`,
    method: 'get'
  })
}
// 根据id修改部门信息
export function updateDeparmentApi (data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'PUT',
    data: data
  })
}
